package blue.starter.internal.mqtt.property;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.List;

/**
 * @author Jin Zheng
 * @since 1.0 2020-07-30
 */
@ConfigurationProperties("blue.mqtt")
public class MqttProperties implements InitializingBean
{
	private List<MqttConfigProperties> configs;

	public MqttProperties()
	{
	}

	public List<MqttConfigProperties> getConfigs()
	{
		return configs;
	}

	public void setConfigs(List<MqttConfigProperties> configs)
	{
		this.configs = configs;
	}

	@Override
	public void afterPropertiesSet()
	{
		if (configs == null)
		{
			return;
		}

		for (MqttConfigProperties config : configs)
		{
			config.afterPropertiesSet();
		}
	}
}
